package com.tianhui.consignortwofei.mvp.model;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.AccountApiService;

import java.util.Map;

import io.reactivex.ObservableTransformer;

/**
 * @author fgs
 * @date 2020/3/27
 **/
public class StatisticsModel<T> extends CommonModel {

    /**
     * 获取车辆总数、附近车辆总数
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void vehicleNumberModel(Context context, boolean isDialog,
                                   ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).vehicleNumber(), observerListener, transformer, isDialog, true);
    }


    /**
     * 司机车辆统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void driverCarStatisticsInfoModel(Context context, Map<String, String> map, boolean isDialog,
                                             ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).driverCarStatisticsInfo(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机车辆统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void driverCarStatisticsDataModel(Context context, Map<String, String> map, boolean isDialog,
                                             ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).driverCarStatisticsData(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 单据统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void orderStatisticsInfoModel(Context context, Map<String, String> map, boolean isDialog,
                                         ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).orderStatisticsInfo(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 单据统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void orderStatisticsDataModel(Context context, Map<String, String> map, boolean isDialog,
                                         ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).orderStatisticsData(map), observerListener, transformer, isDialog, true);
    }
}
